Skip to main content

HCV Calculation

Hash Check Value (HCV) is a special 6-digit number calculated from the binary SHA-256 hash.

Calculation logic in C language

uint8_t sha256[32];
uint32_t hcv;

hcv = (sha256[31] << 24 | sha256[23] << 16 | sha256[7] << 8 | sha256[0]) % 1000000;

There:

  • sha256 is an array of 8-bit unsigned integers containing SHA-256 binary value
  • hcv is calculated HCV value (32-bit unsigned integer)

Calculated HCV value should be converted from the integer value to the ASCII string and then added symbol - between first 3 and last 3 digits.